package hotel;

public class Booking 
{
	private int start, end;
	private Hotel hotel;
	boolean toReturn = true;
	
	public Booking(Hotel inHotel, int startday, int endday)
	{
		hotel = inHotel;
		start = startday;
		end = endday;
		bookRoom();
	}
	private void bookRoom(){
		
		for(int i = start; i< end; i++)
		{
			int p = hotel.getRoomList().get(i);
			if(p < 0){
				toReturn = false;
			}
			else{
			p--;
			}
			hotel.getRoomList().set(i,(Integer) p);
		}
		return;
	}
	public String toString(){
		return ("Hotel: " + hotel.getName() + ", Check In Day :" + start + ", Check Out Day: "+ end);
	}
	public boolean isLegit(){
		return toReturn;
	}
}
